﻿// -----------------------------------------------------------------------
// <copyright file="SortInfo.cs" company="EPAM Systems">
////Copyright (c) EPAM Systems, 2012. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace MBOP.Core.Entities.Library
{
	#region Usings

	using MBOP.Core.Entities.Common;

	#endregion

	/// <summary>
	/// Represents the sorting info.
	/// </summary>
	public struct SortInfo
	{
		#region Private Fields

		/// <summary>
		/// Represents the sorting type.
		/// </summary>
		private SortType _sortingType;

		/// <summary>
		/// Represents the sorting field.
		/// </summary>
		private SortField _sortingField;

		#endregion

		/// <summary>
		/// Gets or sets the sorting type.
		/// </summary>
		public SortType SortingType 
		{
			get 
			{ 
				return this._sortingType; 
			}
			set 
			{ 
				this._sortingType = value; 
			}
		}

		/// <summary>
		/// Gets or sets the sorting field.
		/// </summary>
		public SortField SortingField
		{ 
			get 
			{ 
				return this._sortingField; 
			}
			set 
			{ 
				this._sortingField = value; 
			}
		}

		public SortField GetUnderlyingSortField()
		{
			return this._sortingField == SortField.Default ? SortField.Date : this._sortingField;
		}
		public SortType GetUnderlyingSortType()
		{
			return this._sortingType == SortType.Default ? SortType.Desc : this._sortingType;
		}
	}
}